<!--
 * @Description: 项目权限-公开权限
 * @Author gong
 * @create 2024/9/9 11:23
 -->
<!--setup-->
<script setup>
import { onMounted, getCurrentInstance, ref } from 'vue'
import { to } from 'sf-utils2'
import demoApi from '@/api/modules/demo'
import { ElMessage } from 'element-plus'
import BaseQueryTable from '@shared/base/base-query-table' // 表格共公共组件

const { proxy } = getCurrentInstance()
const props = defineProps({})
const emit = defineEmits([])

/* 状态 */
const queryTable = ref({
  /**
   * @type {TToolsDescriptionsDataItem}
   */
  columns: [
    { label: '用户姓名', prop: 'userName', minWidth: 160 },
    { label: '账号', prop: 'code', minWidth: 160 },
    { label: '所属机构/部门', prop: 'station', minWidth: 260 },
    { label: '角色', prop: 'station', minWidth: 160 },
    { label: '手机号码', prop: 'phone', minWidth: 160 }
  ],
  isViewportFitHeight: true,
  onQuery: async (mark) => {
    const [res, err] = await to(demoApi.projectList())
    if (err || res?.code !== 200) return ElMessage.error(res?.message || String(err))
    mark.total = res?.data?.total
    return {
      dataList: res?.data?.dataList || [],
      mark
    }
  }
})

/* 方法 */

/* 计算 */

/* 监听 */

/* 周期 */
onMounted(() => {})

/* 暴露 */
defineExpose({
  $: proxy.$
})
</script>

<!--render-->
<template>
  <div class="open-auth flex-1">
    <!-- 内容区 -->
    <BaseQueryTable
      v-bind="queryTable"
      ref="baseQueryTableRef"
    />
  </div>
</template>

<!--style-->
<style scoped lang="less"></style>
